<%@page import="java.sql.Date"%>
<%@page import="java.util.*"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" 
	pageEncoding="utf-8"%>

<html>
<head>

<title></title>

</head>

<body>
	<%
		request.setCharacterEncoding("utf-8");
	%>
	<jsp:useBean id="data" class="start.fly.test.database.databaseTool"
		scope="page" />
		
	<%
		
		String CardNumber = request.getParameter("CardNumber");
		float Money = Float.parseFloat(request.getParameter("Money"));
		
		//查询现有金额
		float old_money = data.queryMoneyFromClickCard(CardNumber);
		
		float new_money = Money + old_money;
		
		//更新数据库中的金额
		boolean isRecharge = data.updateMoneyToClickCard(CardNumber, new_money);
		
		if (isRecharge) {
			out.print("<script>alert('充值成功');document.location='getProduct.jsp'</script>");
		} else {
			out.print("<script>alert('充值失败');document.location='getProduct.jsp'</script>");
		}
	%>
</body>
</html>
